﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Infragistics.WebUI.WebCombo;

/// <summary>
/// 控件操作公共方法
/// </summary>
public class uControl
{
    public static int getSelectIndexByID(WebCombo wc, String sDataValue)
    {
        int iReturn = 0;
        for (int i = 1; i < wc.Rows.Count + 1; i++)
        {
            if (wc.Rows[i].GetCellValue(wc.Columns.FromKey("ID")).ToString() == sDataValue)
            {
                iReturn = i;
                break;
            }
        }
        return iReturn;
    }

    public static int getSelectIndexByID(DropDownList ddl, String sValue) {
        int iReturn = 0;
        for (int i = 0; i < ddl.Items.Count ; i++)
        {

            if (ddl.Items[i].Value.ToString() == sValue)
            {
                iReturn = i;
                break;
            }
        }
        return iReturn;
    }
}
